<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function postName(array1) {
            for (let i = 0; i < array1.length; i++) {
                for (let j = 0; j < array1.length - i - 1; j++) {
                    if (array1[j] > array1[j + 1]) {
                        // 位置交换
                        var temp = array1[j]
                        array1[j] = array1[j + 1]
                        array1[j + 1] = temp
                    }
                }
            }
            return array1
        }
        var a = postName([1, 3, 44, 2, 555, 55, 666])
        console.log(a);
    </script>
</body>

</html>